<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Privilege;

/* @var $this yii\web\View */
/* @var $model common\models\Role */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="role-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'role_name')->textInput(['maxlength' => true]) ?>
    <?=$form->field($model, 'pris')->checkboxList(Privilege::find()
        ->select(['pri_name','id'])
        ->orderBy('par_path')
        ->indexBy('id')
        ->where(['is_usable'=>1])
        ->column()); ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '新增' : '修改', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
